package com.sjhang.controller;


import com.sjhang.entity.TbArticle;
import com.sjhang.service.TbArticleService;
import com.sjhang.utils.ListParamVo;
import com.sjhang.utils.ResultResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 技术文章表
 */
@Api(tags = {"文章API接口"})
@RestController
@RequestMapping("/tbArticle")
public class TbArticleController {

    @Resource
    private TbArticleService tbArticleService;

    
    /***
     * 查询所有技术文章
     */
    @ApiOperation(value = "获取文章信息",notes = "获取文章信息",produces = "application/json")
    @PostMapping("/selectArticle")
    public ResultResponse selectArticle(@RequestBody ListParamVo listParamVo){
        return tbArticleService.selectArticle(listParamVo);
    }


    /***
     * 删除自己的技术文章
     */
    @PostMapping("/deleteArticle")
    public ResultResponse deleteArticle(Long articID){
        return tbArticleService.deleteArticle(articID);
    }

    /***
     * 发布文章
     */
    @PostMapping("/insertArticle")
    public ResultResponse insertArticle(TbArticle tbArticle){
        return tbArticleService.insertArticle(tbArticle);
    }

    /***
     * 修改文章
     */
    @PostMapping("/updateArticle")
    public ResultResponse updateArticle(TbArticle tbArticle){
        return tbArticleService.updateArticle(tbArticle);
    }
}

